﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<TemplateWeb.Models.ViewModels.GroupViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<%
    var lstPhien = Model.PhienDauGiaModel.GetModel.LstObjModel;
%>

<div id="bc">
	<div class="ja-breadcrums">
		<strong>You are here:</strong> <span class="breadcrumbs pathway">Danh sách phiên đấu giá thành công</span>
	</div>
</div>
<div id="ja-mainbody" style="width:80%">
    <div id="ja-main" style="width:100%">
        <div id="ja-contentwrap" class="">
            <div id="ja-content" class="column" style="width:100%">
                <div id="ja-current-content" class="column" style="width:100%">
                    <div id="content"></div>
                    <div class="ja-content-main clearfix">
                        <div class="auction_header">Những Phiên Đấu Giá Thành Công</div>
                        <table id="auction_list_container" cellpadding="0" cellspacing="0" width="100%">
                            <tbody>
                                <tr>
                                    <th>Tên sản phẩm</th>
                                    <th style="text-align: center;">Người thắng cuộc</th>
                                    <th style="text-align: center;">Hình thức đấu giá</th>
                                    <th style="text-align: center;">Giá cao nhất</th>
                                    <th style="text-align: center;">Giá thấp nhất</th>
                                    <th style="text-align: center;">Xem chi tiết</th>
                                </tr>
                                <% if (lstPhien.Count == 0)
                                   { %>
                                    <tr>
                                        <td colspan="6">
                                            Chưa có Phiên nào ...
                                        </td>
                                    </tr>
                                <% }
                                   else
                                   {
                                       foreach (var phien in lstPhien)
                                       { %>
                                        <tr>
                                            <td><%= phien.SanPham.TenSanPham %></td>
                                            <td style="text-align: center;">
                                                <%
                                                    long GiaDuaRaMax = 0;
                                                    GiaDuaRaMax = phien.NguoiChoiDauGia.Max(n => n.GiaDuaRa);
                                                 %>
                                                <%= phien.NguoiChoiDauGia.FirstOrDefault(n => n.GiaDuaRa == GiaDuaRaMax).NguoiDung.aspnet_Users.UserName %>
                                            </td>
                                            <td style="text-align: center;"><%= phien.HinhThucDauGia.TenHinhThucDauGia %></td>
                                            <% if (phien.HinhThucDauGia.TenHinhThucDauGia.ToUpper().Contains("ANH"))
                                               { %>
                                               <td style="text-align: center;">
                                                <%
                                                    GiaDuaRaMax = 0;
                                                    if (phien.NguoiChoiDauGia.Count > 0)
                                                    {
                                                        GiaDuaRaMax = phien.NguoiChoiDauGia.Max(n => n.GiaDuaRa);
                                                    }
                                                %>
                                                <%= string.Format("{0:0,0}", GiaDuaRaMax) %>
                                               </td>
                                               <td style="text-align: center;"></td>
                                            <% }
                                               else
                                               { %>
                                               <td style="text-align: center;"></td>
                                               <td style="text-align: center;"></td>
                                            <% } %>
                                            <td style="text-align: center;">
                                                <a href="../Home/XemChiTietPhien?idphien=<%= phien.ID %>">
					                                <span style="text-decoration: underline">Select</span>
				                                </a>
                                            </td>
                                        </tr>
                                    <% }
                                   } %>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</asp:Content>
